package group.rober.rax.devkit.auth;

import group.rober.auth.entity.Role;
import group.rober.auth.entity.User;
import group.rober.auth.service.AuthService;
import group.rober.rax.devkit.auth.entity.RaxUser;
import group.rober.saber.jdbc.DataBeanAccessor;
import group.rober.saber.kit.MapKit;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 * 使用RAX的用户
 */
public class RaxDevkitAuthServiceImpl implements AuthService {

    @Autowired
    protected DataBeanAccessor dataBeanAccessor;

    public List<User> selectUserList(String where, Map<String, Object> vars) {
        return null;
    }

    public User getUser(String id) {
        Map<String,String> param = MapKit.mapOf("userId",id);
        return dataBeanAccessor.queryOne(RaxUser.class,"select * from SYS_USER where UserID=:userId", param);
    }

    public User getUserByCode(String userCode) {
        return getUser(userCode);
    }

    public int saveUser(User user) {
        return 0;
    }

    public int deleteUser(String userId) {
        return 0;
    }

    public Map<String, String> getUserProperties(String userId) {
        return null;
    }

    public int addUserProperty(String userId, String propertyName, String propertyValue) {
        return 0;
    }

    public int removeUserProperty(String userId, String propertyName) {
        return 0;
    }

    public boolean verifyPassword(String userId, String password) {
        return false;
    }

    public void updatePassword(String userId, String password) {

    }

    public Role getRole(String roleId) {
        return null;
    }

    public Role getRoleByCode(String roleCode) {
        return null;
    }

    public int saveRole(Role role) {
        return 0;
    }

    public int deleteRole(String roleId) {
        return 0;
    }

    public List<Role> getUserRoles(String userId) {
        return null;
    }

    public int grantRoleToUser(String roleId, String userId) {
        return 0;
    }

    public int revokeRoleFormUser(String roleId, String userId) {
        return 0;
    }

    public boolean userHasRoleByCode(String userCode, String roleCode) {
        return false;
    }

    public boolean userHasRole(String userId, String roleId) {
        return false;
    }
}
